package com.group3.controller.adminController;

import com.group3.service.AdminService;
import com.group3.utils.Result;
import com.group3.pojo.UpdatePassword;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/**
 * CommonController
 *
 * @author HY
 * 2021/06/03 16:35
 **/

@Api(tags = "管理员接口")
@RestController
@RequestMapping("/admin")
public class AdminController {

    @Resource
    private AdminService adminService;
////    管理员登陆接口
//    @ApiOperation("管理员登陆接口")
//    @PostMapping("/login")
//    public Result login(@RequestBody Login login){
//
//        Result result = null;
//
//        return result;
//    }


    //    管理员修改密码接口
    @ApiOperation(value = "管理员修改密码接口")
    @PutMapping(value = "/password")
    public Result updatePas(@RequestBody UpdatePassword updatePassword,
                            HttpServletRequest request){

        String token = request.getHeader("token");//获取token

        return adminService.updatePas(token, updatePassword);
    }
}
